package com.lwj.liwanjia.presenter;

import com.lwj.liwanjia.bean.fabu.FabuTypeBean;
import com.lwj.liwanjia.impl.FabuTypeView;
import com.lwj.liwanjia.model.FabuTypeModel;

import rx.Subscriber;

/**
 * Created by Administrator on 2018/1/13.
 */

public class FabuTypePresenter {
    private FabuTypeView fabuTypeView;
    private FabuTypeModel fabuTypeModel;

    public FabuTypePresenter(FabuTypeView fabuTypeView) {
        this.fabuTypeView = fabuTypeView;
        fabuTypeModel = new FabuTypeModel();
    }

    public void getTypeData(String token,int id) {
        fabuTypeModel.getTypeData(token, id,new Subscriber<FabuTypeBean>() {
            @Override
            public void onCompleted() {

            }

            @Override
            public void onError(Throwable e) {
                fabuTypeView.showError((Exception) e);
            }

            @Override
            public void onNext(FabuTypeBean fabuTypeBean) {
                fabuTypeView.getTypeData(fabuTypeBean);
            }
        });
    }
}
